﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Gufa.EntityFrameworkCore.Migrations
{
    /// <inheritdoc />
    public partial class AddProjectInfoTable : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_DelFlag_Values3",
                table: "T_Teches");

            migrationBuilder.DropCheckConstraint(
                name: "CK_DelFlag_Values2",
                table: "T_Responsibilities");

            migrationBuilder.CreateTable(
                name: "T_ProjectInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TechStack = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProjectIntroduce = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Duration = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DelFlag = table.Column<int>(type: "int", nullable: false),
                    ExperienceId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_ProjectInfos", x => x.Id);
                    table.CheckConstraint("CK_DelFlag_Values2", "DelFlag IN (0, 1)");
                    table.ForeignKey(
                        name: "FK_T_ProjectInfos_T_Experience_ExperienceId",
                        column: x => x.ExperienceId,
                        principalTable: "T_Experience",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.AddCheckConstraint(
                name: "CK_DelFlag_Values4",
                table: "T_Teches",
                sql: "DelFlag IN (0, 1)");

            migrationBuilder.AddCheckConstraint(
                name: "CK_DelFlag_Values3",
                table: "T_Responsibilities",
                sql: "DelFlag IN (0, 1)");

            migrationBuilder.CreateIndex(
                name: "IX_T_ProjectInfos_ExperienceId",
                table: "T_ProjectInfos",
                column: "ExperienceId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "T_ProjectInfos");

            migrationBuilder.DropCheckConstraint(
                name: "CK_DelFlag_Values4",
                table: "T_Teches");

            migrationBuilder.DropCheckConstraint(
                name: "CK_DelFlag_Values3",
                table: "T_Responsibilities");

            migrationBuilder.AddCheckConstraint(
                name: "CK_DelFlag_Values3",
                table: "T_Teches",
                sql: "DelFlag IN (0, 1)");

            migrationBuilder.AddCheckConstraint(
                name: "CK_DelFlag_Values2",
                table: "T_Responsibilities",
                sql: "DelFlag IN (0, 1)");
        }
    }
}
